﻿using System.Linq;
using System.Windows.Shapes;

namespace DynamicGeometry
{
    public class TranslatedPoint : PointBase, IPoint
    {
        double magnitude;

        public double Magnitude
        {
            get { return magnitude; }
            set { magnitude = value; }
        }
        double direction;

        public double Direction
        {
            get { return direction; }
            set { direction = value; }
        }


        protected override Shape CreateShape()
        {
            return Factory.CreateDependentPointShape();
        }

        public override void Recalculate()
        {
            var source = Point(0);
            Coordinates = Math.GetTranslationPoint(source, magnitude,Math.ToRadians(direction));
            Exists = Coordinates.Exists();
        }
    }
}